﻿@model PhoneBilling.Models.SliceDetailMgtModel
@{
    ViewBag.Title = "分段计费管理";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@if (Model.Message != null){<h2>@Model.Message</h2>}
<script type="text/javascript">
    function changeSlice() {
        window.location.href = "/Manage/SliceDetailMgt/" + $("#sliceList").val();
    }
    function del(id, name) {
        var r = confirm("确认删除分段吗？");
        if (r == true) {
            window.location.href = "/Manage/SliceDetailDelete?sliceID=" + id+"&name="+name;
        }
        return false;
    }
</script>
<p id="btn-create" class="box">当前收费等级表: @Html.DropDownListFor(m => m.CurrentSlice, new SelectList(Model.SliceList, "ID", "Name"), new { id = "sliceList", style = "input-text", onchange = "changeSlice()" })  <a href=@string.Format("{0}?sliceID={1}", "/Manage/SliceDetailEdit", Model.CurrentSlice)><span>新增分段计费表明细</span></a></p>
@{
    
    var grid = new WebGrid(source: Model.SliceDetailList, rowsPerPage: 30);
}
@grid.GetHtml(
    alternatingRowStyle: "bg",
    columns:grid.Columns
    (
        grid.Column("分段起点时间", "分段起点时间"),
        grid.Column("分段截止时间", "分段截止时间"),
        grid.Column("费率", "费率"),
        grid.Column("费用类别", "费用类别"),
        grid.Column("计次单位", "计次单位"),
        grid.Column("是否计算计次", "是否计算计次"),
        grid.Column("名称", "名称"),
        grid.Column(format: (item) => Html.ActionLink("修改", "SliceDetailEdit", new {sliceID = Model.CurrentSlice, name = item.名称 })),
        grid.Column(format: (item) => Html.Raw(string.Format("<a href='javascript:' onclick=\"del('{0}','{1}')\">删除</a>", Model.CurrentSlice, item.名称)))
    )
)


